#include "ShopItemWidget.h"
#include "ShopWidget.h"

#include <QtGui>

void ShopItemWidget::initialize( ShopWidget *shop, QString s ) {
    setPicture( new QImage( s ) );
    setParent( shop );
    setToolTip( item->getToolTip() );
}

void ShopItemWidget::mousePressEvent( QMouseEvent* ) {
    item->purchase();
}

void ShopItemWidget::setPicture( QImage* i ) {
    QPixmap map;
    map.convertFromImage( *i );
    map = map.scaledToWidth( WIDTH );
    map = map.scaledToHeight( HEIGHT );
    picture->setPixmap( map );
    picture->setGeometry( QRect( 50, 50, 250, 250 ) );

    //  QBoxLayout* layout = new QBoxLayout( QBoxLayout::LeftToRight );
    //this->setLayout( layout );
}
